local UIBase = require("view.UIBase")
local PopupAlert = class("PopupAlert", UIBase)
local UIUtil = require("utils.UIUtil")

function PopupAlert:ctor()
    local resource = {
        path = "Prefabs/Popup",
        name = "PopupAlert",
        canvas = 3
    }
    PopupAlert.super.ctor(self, resource)
end

function PopupAlert:start()
    self._btnOk.onClick:AddListener(handler(self, self._onBtnOkClick))
end

function PopupAlert:updateUI(title, content)
    self._textTitle.text = title
    self._textContent.text = content
end

function PopupAlert:setCallback(callback)
    self._callback = callback
end

function PopupAlert:onClose()
end

function PopupAlert:_onBtnOkClick()
    if self._callback then
        self._callback()
    end
    self:close()
end

return PopupAlert
